/**
 * index 页面的仓库
 * state:属性
 * mutations:方法
 */
import { action } from "mobx-miniprogram";
import {
    getProducts
} from '../../api/path/index.js'
const state = {
    tabBerActive: 0,
    classList: [
        {
            name: '服装馆',
            image: 'https://xckf-bucket.oss-cn-guangzhou.aliyuncs.com/102/images/icon/icon1.png'
        },
        {
            name: '体育用品',
            image: 'https://xckf-bucket.oss-cn-guangzhou.aliyuncs.com/102/images/icon/icon2.png'
        },
        {
            name: '汽车展',
            image: 'https://xckf-bucket.oss-cn-guangzhou.aliyuncs.com/102/images/icon/icon3.png'
        },
        {
            name: '沃尔玛',
            image: 'https://xckf-bucket.oss-cn-guangzhou.aliyuncs.com/102/images/icon/icon4.png'
        }
    ],
    goods_list: [
    ],
}

const mutations = {
    addCount: action(function (val) {
        this.tabBerActive = val;
    }),

    getProductsList: action(function () {
        getProducts({ name: '' }).then(res => {
            console.log(res);

            this.goods_list = res.data;
        })
    })

}

export default {
    ...state,
    ...mutations
}